#ifndef CONNECTION_H
#define CONNECTION_H

#include <QtSql>
#include <QMessageBox>

static bool createConnection()
{
    QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
    db.setHostName("localhost");
    db.setDatabaseName("biblio");
    db.setUserName("root");
    db.setPassword("gse");
    if (!db.open())
    {
        QMessageBox::critical(0, "Cannot open database", "Unable to establish a database connection.\n Click Cancel to exit.", QMessageBox::Cancel);
        return false;
    }
}

#endif // CONNECTION_H
